package com.zjj.learn.algorithmPlus.segment2.binaryTree;

/**
 * 二叉搜索树节点
 *
 * @author zjj_admin
 */
public class BSTNode<K extends Comparable<K>, V> {

    /**
     * 当前极点的key
     */
    K key;
    /**
     * 节点值
     */
    V data;
    BSTNode<K, V> left;
    BSTNode<K, V> right;

    public BSTNode(K key, V data, BSTNode<K, V> left, BSTNode<K, V> right) {
        this.key = key;
        this.data = data;
        this.left = left;
        this.right = right;
    }

    public BSTNode(K key, V data) {
        this.key = key;
        this.data = data;
    }

    @Override
    public String toString() {
        return "BSTNode{" +
                "key=" + key +
                ", data=" + data +
                '}';
    }
}
